import {
  defineConfig,
  presetAttributify,
  presetIcons,
  presetUno,
  transformerDirectives,
  transformerVariantGroup,
} from 'unocss'
import { FileSystemIconLoader } from 'unplugin-icons/loaders'

export default defineConfig({
  shortcuts: {
    'icon-btn': 'opacity-50 !px-2 !py-3 hover:opacity-100 !h-[26px] outline-none',
  },
  presets: [
    presetUno(),
    presetAttributify(),
    presetIcons({
      extraProperties: {
        'display': 'inline-block',
        'vertical-align': 'middle',
      },
      scale: 1.2,
      warn: true,
      collections: {
        custom: FileSystemIconLoader('./src/icons'),
      },
    }),
  ],
  transformers: [
    transformerDirectives({
      applyVariable: ['--un-apply'],
    }),
    transformerVariantGroup(),
  ],
  rules: [
    [
      'font-pmzd',
      {
        'font-family': `'PangMenZhengDao', sans-serif`,
      },
    ],
  ],
  safelist: [
    'i-ri:list-check-2',
    'i-ri:dashboard-line',
    'i-ri:database-2-line',
    'i-ri:alarm-warning-line',
    'i-ri:calendar-schedule-line',
    'i-ri:openai-fill',
    'i-ri:24-hours-line',
    'i-ri:airplay-fill',
  ],
})
